// Do file that conducts the analyses of the UK and US data presented in the paper "Persistent Inequalities


***FIGURES 2 AND 3/TABLE A17***

use "E:\ProjData\AdoptionStudy\YPSPS\YPSPS1.dta", clear

append using "E:\ProjData\AdoptionStudy\YPSPS\YPSPS2.dta"
append using "E:\ProjData\AdoptionStudy\BHPS\BHPS.dta"
append using "E:\ProjData\AdoptionStudy\MNData\MNData.dta"


*YPSPS G1G2
qui reg turnoutkid turnoutparentcum i.parentbyear kidfemale i.kidelectionage i.electionyear i.sample if sample==1, cluster(famid)
lincom turnoutparentcum
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistent i.parentbyear##c.parentconsistent c.kidfemale##c.parentconsistent i.kidelectionage##c.parentconsistent i.electionyear##c.parentconsistent i.sample##c.parentconsistent if sample==1, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistent
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistent
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistentHI i.parentbyear##c.parentconsistentHI c.kidfemale##c.parentconsistentHI i.kidelectionage##c.parentconsistentHI i.electionyear##c.parentconsistentHI i.sample##c.parentconsistentHI if sample==1, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistentHI
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistentHI
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid turnoutparentcum c.turnoutparentcum#c.kidelectionage01 i.parentbyear i.parentbyear#c.kidelectionage01 kidfemale c.kidfemale#c.kidelectionage i.kidelectionage i.electionyear i.electionyear#c.kidelectionage01 i.sample i.sample#c.kidelectionage01 if sample==1, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.kidelectionage01
lincom turnoutparentcum + c.turnoutparentcum#c.kidelectionage01
sum turnoutkid turnoutparentcum if e(sample)


*YPSPS G2G3
qui reg turnoutkid turnoutparentcum i.parentbyear kidfemale i.kidelectionage i.electionyear i.sample if sample==2, cluster(famid)
lincom turnoutparentcum
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistent i.parentbyear##c.parentconsistent c.kidfemale##c.parentconsistent i.kidelectionage##c.parentconsistent i.electionyear##c.parentconsistent i.sample##c.parentconsistent if sample==2, cluster(famid)
lincom parentconsistent
lincom c.turnoutparentcum#c.parentconsistent
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistent
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistentHI i.parentbyear##c.parentconsistentHI c.kidfemale##c.parentconsistentHI i.kidelectionage##c.parentconsistentHI i.electionyear##c.parentconsistentHI i.sample##c.parentconsistentHI if sample==2, cluster(famid)
lincom parentconsistentHI
lincom c.turnoutparentcum#c.parentconsistentHI
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistentHI
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid turnoutparentcum c.turnoutparentcum#c.kidelectionage01 i.parentbyear i.parentbyear#c.kidelectionage01 kidfemale c.kidfemale#c.kidelectionage i.kidelectionage i.electionyear i.electionyear#c.kidelectionage01 i.sample i.sample#c.kidelectionage01 if sample==2, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.kidelectionage01
lincom turnoutparentcum + c.turnoutparentcum#c.kidelectionage01
sum turnoutkid turnoutparentcum if e(sample)


*BHPS
qui reg turnoutkid turnoutparentcum i.parentbyear kidfemale i.kidelectionage i.electionyear i.sample if sample==3, cluster(famid)
lincom turnoutparentcum
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistent i.parentbyear##c.parentconsistent c.kidfemale##c.parentconsistent i.kidelectionage##c.parentconsistent i.electionyear##c.parentconsistent i.sample##c.parentconsistent if sample==3, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistent
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistent
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistentHI i.parentbyear##c.parentconsistentHI c.kidfemale##c.parentconsistentHI i.kidelectionage##c.parentconsistentHI i.electionyear##c.parentconsistentHI i.sample##c.parentconsistentHI if sample==3, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistentHI
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistentHI
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid turnoutparentcum c.turnoutparentcum#c.kidelectionage01 i.parentbyear i.parentbyear#c.kidelectionage01 kidfemale c.kidfemale#c.kidelectionage i.kidelectionage i.electionyear i.electionyear#c.kidelectionage01 i.sample i.sample#c.kidelectionage01 if sample==3, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.kidelectionage01
lincom turnoutparentcum + c.turnoutparentcum#c.kidelectionage01
sum turnoutkid turnoutparentcum if e(sample)


*MN
qui reg turnoutkid turnoutparentcum i.parentbyear kidfemale i.kidelectionage i.electionyear i.sample if sample==4 & RELATED==1, cluster(famid)
lincom turnoutparentcum
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid turnoutparentcum i.parentbyear kidfemale i.kidelectionage i.electionyear i.sample if sample==4 & RELATED==0, cluster(famid)
lincom turnoutparentcum
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.RELATED i.parentbyear##c.RELATED c.kidfemale##c.RELATED i.kidelectionage##c.RELATED i.electionyear##c.RELATED, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.RELATED
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistent i.parentbyear##c.parentconsistent c.kidfemale##c.parentconsistent i.kidelectionage##c.parentconsistent i.electionyear##c.parentconsistent i.sample##c.parentconsistent if sample==4 & RELATED==1, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistent
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistent
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistentHI i.parentbyear##c.parentconsistentHI c.kidfemale##c.parentconsistentHI i.kidelectionage##c.parentconsistentHI i.electionyear##c.parentconsistentHI i.sample##c.parentconsistentHI if sample==4 & RELATED==1, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistentHI
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistentHI
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid turnoutparentcum c.turnoutparentcum#c.kidelectionage01 i.parentbyear i.parentbyear#c.kidelectionage01 kidfemale c.kidfemale#c.kidelectionage i.kidelectionage i.electionyear i.electionyear#c.kidelectionage01 i.sample i.sample#c.kidelectionage01 if sample==4 & RELATED==1, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.kidelectionage01
lincom turnoutparentcum + c.turnoutparentcum#c.kidelectionage01
sum turnoutkid turnoutparentcum if e(sample)


*Pooled
drop if RELATED==0

qui reg turnoutkid turnoutparentcum i.parentbyear kidfemale i.kidelectionage i.electionyear i.sample, cluster(famid)
lincom turnoutparentcum
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistent i.parentbyear##c.parentconsistent c.kidfemale##c.parentconsistent i.kidelectionage##c.parentconsistent i.electionyear##c.parentconsistent i.sample##c.parentconsistent, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistent
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistent
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid c.turnoutparentcum##c.parentconsistentHI i.parentbyear##c.parentconsistentHI c.kidfemale##c.parentconsistentHI i.kidelectionage##c.parentconsistentHI i.electionyear##c.parentconsistentHI i.sample##c.parentconsistentHI, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.parentconsistentHI
lincom turnoutparentcum + c.turnoutparentcum#c.parentconsistentHI
sum turnoutkid turnoutparentcum if e(sample)

qui reg turnoutkid turnoutparentcum c.turnoutparentcum#c.kidelectionage01 i.parentbyear i.parentbyear#c.kidelectionage01 kidfemale c.kidfemale#c.kidelectionage i.kidelectionage i.electionyear i.electionyear#c.kidelectionage01 i.sample i.sample#c.kidelectionage01, cluster(famid)
lincom turnoutparentcum
lincom c.turnoutparentcum#c.kidelectionage01
lincom turnoutparentcum + c.turnoutparentcum#c.kidelectionage01
sum turnoutkid turnoutparentcum if e(sample)

